# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[GenericContainer.__init__(self, type_='parameter', **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb762da8c>}
nname: 0
n 0(None)[return [IterItemContainer(name='day', iter_=<genexpr>(xrange(1, 32)), menu=self.menu, parent=self.parent), IterItemContainer(name='month', iter_=month_dict, menu=self.menu, parent=self.parent), IterItemContainer(name='year', iter_=xrange(2000, 2020), menu=self.menu, parent=self.parent), IterItemContainer(name='hour', iter_=<genexpr>(xrange(24)), menu=self.menu, parent=self.parent), IterItemContainer(name='min', iter_=<genexpr>(xrange(60)), menu=self.menu, parent=self.parent)]
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb763156c>}
nname: 6
n 6(None)[def __init__(self, **kw):
	GenericContainer.__init__(self, type_='parameter', **kw)

def browse(self):
	return [IterItemContainer(name='day', iter_=<genexpr>(xrange(1, 32)), menu=self.menu, parent=self.parent), IterItemContainer(name='month', iter_=month_dict, menu=self.menu, parent=self.parent), IterItemContainer(name='year', iter_=xrange(2000, 2020), menu=self.menu, parent=self.parent), IterItemContainer(name='hour', iter_=<genexpr>(xrange(24)), menu=self.menu, parent=self.parent), IterItemContainer(name='min', iter_=<genexpr>(xrange(60)), menu=self.menu, parent=self.parent)]

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb762d58c>}
nname: 0
n 0(None)[class DateContainer(GenericContainer):
	def __init__(self, **kw):
		GenericContainer.__init__(self, type_='parameter', **kw)

	def browse(self):
		return [IterItemContainer(name='day', iter_=<genexpr>(xrange(1, 32)), menu=self.menu, parent=self.parent), IterItemContainer(name='month', iter_=month_dict, menu=self.menu, parent=self.parent), IterItemContainer(name='year', iter_=xrange(2000, 2020), menu=self.menu, parent=self.parent), IterItemContainer(name='hour', iter_=<genexpr>(xrange(24)), menu=self.menu, parent=self.parent), IterItemContainer(name='min', iter_=<genexpr>(xrange(60)), menu=self.menu, parent=self.parent)]



UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
self.preview_list = DateContainer(name='Date', menu=self.menu, parent=self).browse()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761df6c>}
nname: 0
n 0(None)[from time import mktime
year, month, day, hour, min = (int(val[2]), int(val[1]), int(val[0]), int(val[3]), int(val[4]))
time_sec = mktime((year, month, day, hour, min, 0, 0, 0, -1))
from pygui.config import user_config
TimeManager().time_setter = 1
TimeManager().set_time(time_sec)
TimeManager().time_setter = user_config['base']['timeupdatemode']
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb762ddcc>}
nname: 6
n 6(None)[translation_dict = month_dict
def __init__(self, domain, key, *args, **args):
	class DateContainer(GenericContainer):
		def __init__(self, **kw):
			GenericContainer.__init__(self, type_='parameter', **kw)

		def browse(self):
			return [IterItemContainer(name='day', iter_=<genexpr>(xrange(1, 32)), menu=self.menu, parent=self.parent), IterItemContainer(name='month', iter_=month_dict, menu=self.menu, parent=self.parent), IterItemContainer(name='year', iter_=xrange(2000, 2020), menu=self.menu, parent=self.parent), IterItemContainer(name='hour', iter_=<genexpr>(xrange(24)), menu=self.menu, parent=self.parent), IterItemContainer(name='min', iter_=<genexpr>(xrange(60)), menu=self.menu, parent=self.parent)]



	UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
	self.preview_list = DateContainer(name='Date', menu=self.menu, parent=self).browse()

def execute_action(self, val):
	from time import mktime
	year, month, day, hour, min = (int(val[2]), int(val[1]), int(val[0]), int(val[3]), int(val[4]))
	time_sec = mktime((year, month, day, hour, min, 0, 0, 0, -1))
	from pygui.config import user_config
	TimeManager().time_setter = 1
	TimeManager().set_time(time_sec)
	TimeManager().time_setter = user_config['base']['timeupdatemode']

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d4ec>}
nname: 0
n 0(None)[ActionItem.__init__(self, *args, **kw)
self.preview_list = []
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761d96c>}
nname: 58
n 58(None)[]:
	i: 34(), 57()
	o: 

nname: 57
n 57(None)[]:
	i: 0(f)
	o: 58()

nname: 34
n 34(None)[DateSetupMenu().show(hide_previous_menu=False)
]:
	i: 0(t)
	o: 58()

nname: 0
n 0(TimeManager().time_setter == 1)[from pygui.menu.menu.timezone import DateSetupMenu
]:
	i: 
	o: 34(t), 57(f)

nname: 0
n 0(None)[from pygui.menu.menu.timezone import DateSetupMenu
if TimeManager().time_setter == 1:
	DateSetupMenu().show(hide_previous_menu=False)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761da0c>}
nname: 6
n 6(None)[def __init__(self, *args, **args):
	ActionItem.__init__(self, *args, **kw)
	self.preview_list = []

def execute(self):
	from pygui.menu.menu.timezone import DateSetupMenu
	if TimeManager().time_setter == 1:
		DateSetupMenu().show(hide_previous_menu=False)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d56c>}
nname: 0
n 0(None)[TimeManager().time_setter = val
self.reload_center_list(True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761daac>}
nname: 6
n 6(None)[translation_dict = UnicodeDict({1: 'Manual', 3: 'Automatic'})
def execute_action(self, val):
	TimeManager().time_setter = val
	self.reload_center_list(True)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d6ec>}
nname: 0
n 0(None)[louie_send('clock', sender='clock', date_format=get_date_format())
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761de0c>}
nname: 6
n 6(None)[translation_dict = UnicodeDict({0: 'YYYY/MM/DD', 1: 'DD/MM/YYYY', 2: 'MM/DD/YYYY'})
def execute_action(self, val):
	louie_send('clock', sender='clock', date_format=get_date_format())

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761ddec>}
nname: 0
n 0(None)[louie_send('clock', sender='clock', time_format=get_time_format())
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761deac>}
nname: 6
n 6(None)[translation_dict = UnicodeDict({0: '12 hours', 1: '24 hours'})
def execute_action(self, val):
	louie_send('clock', sender='clock', time_format=get_time_format())

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d80c>}
nname: 0
n 0(None)[ActionItem.__init__(self, *args, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761d52c>}
nname: 0
n 0(None)[from pygui.menu.menu.timezone import TimeZoneSetupMenu
TimeZoneSetupMenu(name=_('Time zone')).show(hide_previous_menu=False)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761deac>}
nname: 6
n 6(None)[def __init__(self, *args, **args):
	ActionItem.__init__(self, *args, **kw)

def execute(self):
	from pygui.menu.menu.timezone import TimeZoneSetupMenu
	TimeZoneSetupMenu(name=_('Time zone')).show(hide_previous_menu=False)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d80c>}
nname: 54
n 54(None)[]:
	i: 3(), 33(), 52(AE)
	o: 

nname: 52
n 52(None)[]:
	i: 23(f)
	o: 54(AE)

nname: 33
n 33(None)[#, e
PRINT_EXCEPTION(e)
]:
	i: 23(t)
	o: 54()

nname: 23
n 23(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 0(except)
	o: 33(t), 52(f)

nname: 3
n 3(None)[TimeManager().set_timezone(val)
]:
	i: 0(try)
	o: 54()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 23(except)

nname: 23
n 23(None)[except Exception, e:
	PRINT_EXCEPTION(e)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	TimeManager().set_timezone(val)
]:
	i: 
	o: 23()

nname: 0
n 0(None)[try:
	TimeManager().set_timezone(val)
except Exception, e:
	PRINT_EXCEPTION(e)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761db6c>}
nname: 6
n 6(None)[translation_dict = dict(<genexpr>(TimeManager().get_timezones()))
def execute_action(self, val):
	try:
		TimeManager().set_timezone(val)
	except Exception, e:
		PRINT_EXCEPTION(e)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d56c>}
nname: 0
n 0(None)[ParametersSetupItem.__init__(self, *args, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761df6c>}
nname: 161
n 161(None)[preview_list.append(TimeZoneItem(_('Time zone'), 'setupitem', menu=self.menu))
return preview_list
]:
	i: 119(), 160()
	o: 

nname: 160
n 160(None)[]:
	i: 0(f)
	o: 161()

nname: 119
n 119(None)[preview_list.append(ModifyDateSetupItem(_('Time set'), 'setupitem', menu=self.menu))
]:
	i: 0(t)
	o: 161()

nname: 0
n 0(user_config['base']['timeupdatemode'] == 1)[preview_list = [UpdateModeItem('base', 'timeupdatemode', [1, 3], 'Update mode', type_='setupitem'), DateFormatItem('base', 'dateformat', [0, 1, 2], 'Date format', type_='setupitem'), TimeFormatItem('base', 'timeformat', [0, 1], 'Time format', type_='setupitem')]
]:
	i: 
	o: 119(t), 160(f)

nname: 0
n 0(None)[preview_list = [UpdateModeItem('base', 'timeupdatemode', [1, 3], 'Update mode', type_='setupitem'), DateFormatItem('base', 'dateformat', [0, 1, 2], 'Date format', type_='setupitem'), TimeFormatItem('base', 'timeformat', [0, 1], 'Time format', type_='setupitem')]
if user_config['base']['timeupdatemode'] == 1:
	preview_list.append(ModifyDateSetupItem(_('Time set'), 'setupitem', menu=self.menu))
preview_list.append(TimeZoneItem(_('Time zone'), 'setupitem', menu=self.menu))
return preview_list
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb762dfac>}
nname: 6
n 6(None)[depth = 3
def __init__(self, *args, **args):
	ParametersSetupItem.__init__(self, *args, **kw)

def browse(self):
	preview_list = [UpdateModeItem('base', 'timeupdatemode', [1, 3], 'Update mode', type_='setupitem'), DateFormatItem('base', 'dateformat', [0, 1, 2], 'Date format', type_='setupitem'), TimeFormatItem('base', 'timeformat', [0, 1], 'Time format', type_='setupitem')]
	if user_config['base']['timeupdatemode'] == 1:
		preview_list.append(ModifyDateSetupItem(_('Time set'), 'setupitem', menu=self.menu))
	preview_list.append(TimeZoneItem(_('Time zone'), 'setupitem', menu=self.menu))
	return preview_list

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d5cc>}
nname: 0
n 0(None)[self.template = template
Item.__init__(self, name='', type_='setupitem', menu=menu, *args, **kw)
self._t = Task(self.update_name)
self._t.start(delay=1, loop=True, init_delay=0, consider_idle=True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761dccc>}
nname: 0
n 0(None)[tt = localtime()[:-4]
self.name = self.template % dict(<genexpr>(zip(DateClockSetupItem.format, tt)))
self.reset_view()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761db6c>}
nname: 0
n 0(None)[self._t.stop()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb761d68c>}
nname: 6
n 6(None)[__doc__ = '\n    This item permits to get date and time and refresh it every second (thaks to Task)\n    '
format = ('Y', 'M', 'd', 'h', 'm', 's')
def __init__(self, template, menu, *args, **args):
	self.template = template
	Item.__init__(self, name='', type_='setupitem', menu=menu, *args, **kw)
	self._t = Task(self.update_name)
	self._t.start(delay=1, loop=True, init_delay=0, consider_idle=True)

def update_name(self):
	tt = localtime()[:-4]
	self.name = self.template % dict(<genexpr>(zip(DateClockSetupItem.format, tt)))
	self.reset_view()

def stop(self):
	self._t.stop()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb761d16c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from pygui.config import user_config
from pygui.item.core import Item
from pygui.item.parameters import UserConfigSetupMultipleItem, UserConfigSetupItem, ParametersSetupItem
from pygui.item.parameters import IterItemContainer
from pygui.item.containers import GenericContainer
from pygui.item.core import ActionItem
from pygui.facilities.codemapping import month_dict
from pygui.facilities.l10n import UnicodeDict, get_date_format, get_time_format
from peewee.debug import PRINT_EXCEPTION
from peewee.notifier import Task
from peewee.dateutils import TimeManager
from peewee.messages import send as louie_send
class DateUserConfigSetupItem(UserConfigSetupMultipleItem):
	translation_dict = month_dict
	def __init__(self, domain, key, *args, **args):
		class DateContainer(GenericContainer):
			def __init__(self, **kw):
				GenericContainer.__init__(self, type_='parameter', **kw)

			def browse(self):
				return [IterItemContainer(name='day', iter_=<genexpr>(xrange(1, 32)), menu=self.menu, parent=self.parent), IterItemContainer(name='month', iter_=month_dict, menu=self.menu, parent=self.parent), IterItemContainer(name='year', iter_=xrange(2000, 2020), menu=self.menu, parent=self.parent), IterItemContainer(name='hour', iter_=<genexpr>(xrange(24)), menu=self.menu, parent=self.parent), IterItemContainer(name='min', iter_=<genexpr>(xrange(60)), menu=self.menu, parent=self.parent)]



		UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
		self.preview_list = DateContainer(name='Date', menu=self.menu, parent=self).browse()

	def execute_action(self, val):
		from time import mktime
		year, month, day, hour, min = (int(val[2]), int(val[1]), int(val[0]), int(val[3]), int(val[4]))
		time_sec = mktime((year, month, day, hour, min, 0, 0, 0, -1))
		from pygui.config import user_config
		TimeManager().time_setter = 1
		TimeManager().set_time(time_sec)
		TimeManager().time_setter = user_config['base']['timeupdatemode']



class ModifyDateSetupItem(ActionItem):
	def __init__(self, *args, **args):
		ActionItem.__init__(self, *args, **kw)
		self.preview_list = []

	def execute(self):
		from pygui.menu.menu.timezone import DateSetupMenu
		if TimeManager().time_setter == 1:
			DateSetupMenu().show(hide_previous_menu=False)



class UpdateModeItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({1: 'Manual', 3: 'Automatic'})
	def execute_action(self, val):
		TimeManager().time_setter = val
		self.reload_center_list(True)



class DateFormatItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({0: 'YYYY/MM/DD', 1: 'DD/MM/YYYY', 2: 'MM/DD/YYYY'})
	def execute_action(self, val):
		louie_send('clock', sender='clock', date_format=get_date_format())



class TimeFormatItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({0: '12 hours', 1: '24 hours'})
	def execute_action(self, val):
		louie_send('clock', sender='clock', time_format=get_time_format())



class TimeZoneItem(ActionItem):
	def __init__(self, *args, **args):
		ActionItem.__init__(self, *args, **kw)

	def execute(self):
		from pygui.menu.menu.timezone import TimeZoneSetupMenu
		TimeZoneSetupMenu(name=_('Time zone')).show(hide_previous_menu=False)



class TimeZoneUserConfigSetupItem(UserConfigSetupItem):
	translation_dict = dict(<genexpr>(TimeManager().get_timezones()))
	def execute_action(self, val):
		try:
			TimeManager().set_timezone(val)
		except Exception, e:
			PRINT_EXCEPTION(e)



class DateParametersContainer(ParametersSetupItem):
	depth = 3
	def __init__(self, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)

	def browse(self):
		preview_list = [UpdateModeItem('base', 'timeupdatemode', [1, 3], 'Update mode', type_='setupitem'), DateFormatItem('base', 'dateformat', [0, 1, 2], 'Date format', type_='setupitem'), TimeFormatItem('base', 'timeformat', [0, 1], 'Time format', type_='setupitem')]
		if user_config['base']['timeupdatemode'] == 1:
			preview_list.append(ModifyDateSetupItem(_('Time set'), 'setupitem', menu=self.menu))
		preview_list.append(TimeZoneItem(_('Time zone'), 'setupitem', menu=self.menu))
		return preview_list



class DateClockSetupItem(Item):
	__doc__ = '\n    This item permits to get date and time and refresh it every second (thaks to Task)\n    '
	format = ('Y', 'M', 'd', 'h', 'm', 's')
	def __init__(self, template, menu, *args, **args):
		self.template = template
		Item.__init__(self, name='', type_='setupitem', menu=menu, *args, **kw)
		self._t = Task(self.update_name)
		self._t.start(delay=1, loop=True, init_delay=0, consider_idle=True)

	def update_name(self):
		tt = localtime()[:-4]
		self.name = self.template % dict(<genexpr>(zip(DateClockSetupItem.format, tt)))
		self.reset_view()

	def stop(self):
		self._t.stop()



from time import localtime
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76188cc>}
from __future__ import absolute_import
from pygui.config import user_config
from pygui.item.core import Item
from pygui.item.parameters import UserConfigSetupMultipleItem, UserConfigSetupItem, ParametersSetupItem
from pygui.item.parameters import IterItemContainer
from pygui.item.containers import GenericContainer
from pygui.item.core import ActionItem
from pygui.facilities.codemapping import month_dict
from pygui.facilities.l10n import UnicodeDict, get_date_format, get_time_format
from peewee.debug import PRINT_EXCEPTION
from peewee.notifier import Task
from peewee.dateutils import TimeManager
from peewee.messages import send as louie_send
class DateUserConfigSetupItem(UserConfigSetupMultipleItem):
	translation_dict = month_dict
	def __init__(self, domain, key, *args, **args):
		class DateContainer(GenericContainer):
			def __init__(self, **kw):
				GenericContainer.__init__(self, type_='parameter', **kw)

			def browse(self):
				return [IterItemContainer(name='day', iter_=<genexpr>(xrange(1, 32)), menu=self.menu, parent=self.parent), IterItemContainer(name='month', iter_=month_dict, menu=self.menu, parent=self.parent), IterItemContainer(name='year', iter_=xrange(2000, 2020), menu=self.menu, parent=self.parent), IterItemContainer(name='hour', iter_=<genexpr>(xrange(24)), menu=self.menu, parent=self.parent), IterItemContainer(name='min', iter_=<genexpr>(xrange(60)), menu=self.menu, parent=self.parent)]



		UserConfigSetupMultipleItem.__init__(self, domain, key, *args, **kw)
		self.preview_list = DateContainer(name='Date', menu=self.menu, parent=self).browse()

	def execute_action(self, val):
		from time import mktime
		year, month, day, hour, min = (int(val[2]), int(val[1]), int(val[0]), int(val[3]), int(val[4]))
		time_sec = mktime((year, month, day, hour, min, 0, 0, 0, -1))
		from pygui.config import user_config
		TimeManager().time_setter = 1
		TimeManager().set_time(time_sec)
		TimeManager().time_setter = user_config['base']['timeupdatemode']



class ModifyDateSetupItem(ActionItem):
	def __init__(self, *args, **args):
		ActionItem.__init__(self, *args, **kw)
		self.preview_list = []

	def execute(self):
		from pygui.menu.menu.timezone import DateSetupMenu
		if TimeManager().time_setter == 1:
			DateSetupMenu().show(hide_previous_menu=False)



class UpdateModeItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({1: 'Manual', 3: 'Automatic'})
	def execute_action(self, val):
		TimeManager().time_setter = val
		self.reload_center_list(True)



class DateFormatItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({0: 'YYYY/MM/DD', 1: 'DD/MM/YYYY', 2: 'MM/DD/YYYY'})
	def execute_action(self, val):
		louie_send('clock', sender='clock', date_format=get_date_format())



class TimeFormatItem(UserConfigSetupItem):
	translation_dict = UnicodeDict({0: '12 hours', 1: '24 hours'})
	def execute_action(self, val):
		louie_send('clock', sender='clock', time_format=get_time_format())



class TimeZoneItem(ActionItem):
	def __init__(self, *args, **args):
		ActionItem.__init__(self, *args, **kw)

	def execute(self):
		from pygui.menu.menu.timezone import TimeZoneSetupMenu
		TimeZoneSetupMenu(name=_('Time zone')).show(hide_previous_menu=False)



class TimeZoneUserConfigSetupItem(UserConfigSetupItem):
	translation_dict = dict(<genexpr>(TimeManager().get_timezones()))
	def execute_action(self, val):
		try:
			TimeManager().set_timezone(val)
		except Exception, e:
			PRINT_EXCEPTION(e)



class DateParametersContainer(ParametersSetupItem):
	depth = 3
	def __init__(self, *args, **args):
		ParametersSetupItem.__init__(self, *args, **kw)

	def browse(self):
		preview_list = [UpdateModeItem('base', 'timeupdatemode', [1, 3], 'Update mode', type_='setupitem'), DateFormatItem('base', 'dateformat', [0, 1, 2], 'Date format', type_='setupitem'), TimeFormatItem('base', 'timeformat', [0, 1], 'Time format', type_='setupitem')]
		if user_config['base']['timeupdatemode'] == 1:
			preview_list.append(ModifyDateSetupItem(_('Time set'), 'setupitem', menu=self.menu))
		preview_list.append(TimeZoneItem(_('Time zone'), 'setupitem', menu=self.menu))
		return preview_list



class DateClockSetupItem(Item):
	__doc__ = '\n    This item permits to get date and time and refresh it every second (thaks to Task)\n    '
	format = ('Y', 'M', 'd', 'h', 'm', 's')
	def __init__(self, template, menu, *args, **args):
		self.template = template
		Item.__init__(self, name='', type_='setupitem', menu=menu, *args, **kw)
		self._t = Task(self.update_name)
		self._t.start(delay=1, loop=True, init_delay=0, consider_idle=True)

	def update_name(self):
		tt = localtime()[:-4]
		self.name = self.template % dict(<genexpr>(zip(DateClockSetupItem.format, tt)))
		self.reset_view()

	def stop(self):
		self._t.stop()



from time import localtime
